/**
 * 将16进制字符数字转换为整数
 */

#include <stdio.h>
#include <string.h>
#include <ctype.h>

#define MAXLINE 1000

unsigned int htoi(const char s[]);

int main() {
    char line[MAXLINE];
    scanf("%s", line);
    printf("0x%x\n", htoi(line));

    return 0;
}

unsigned int htoi(const char s[]) {
    unsigned int i, j, len, n;

    for (i = 0, len = strlen(s); i < len; i++) {
        if (s[i] == '0' && tolower(s[i+1]) == 'x') {
            n = 0;
            for (j = i + 2; isdigit(s[j]) || tolower(s[j]) >= 'a' && tolower(s[j]) <= 'f'; j++) {
                n = n * 16 + ((tolower(s[j]) >= 'a') ? (tolower(s[j]) - 'a' + 10) : (s[j] - '0'));
            }
            return n;
        }
    }
    return -1;
}
